home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / FREENET / JENKIN / 022B / 022b / SA / SAsource (.txt) < prev   
RISC OS BBC BASIC V Source  |  1998-08-31  |  19KB  |  852 lines

  1.  connect status :
  2.  0 = not connected
  3.  1 = trying
  4.  2 = *** reserved ***
  5.  +-2.5 waiting for confirmation of connect
  6.  3 = connected
  7.  +- 3.5 = download initiated
  8.  4 = downloaded
  9.  5 = ticking (on/off)
  10.  y% 8
  11.  y%!0=&4AF80:y%!4=&400C1
  12.  "Wimp_Initialise",310,&4B534154,"Ticker",y% 
  13.  ,task%
  14. close:
  15. $+" code "+
  16.  "Hourglass_Smash":
  17.  "OS_ReadMonotonicTime" 
  18.  time%
  19.   saold=time%
  20.  "Wimp_ReadSysInfo",7 
  21.  wimp
  22.  wimp>=350 
  23.  wimp=
  24.  wimp=
  25. connectstatus=1
  26.  mtresolv 
  27. open_resolver_window
  28.  inwindow 
  29. colourchange
  30.  toggle 
  31.  connectstatus 
  32.      
  33.      
  34. firstone
  35.      
  36.  3.5:
  37. threepointfive
  38.      
  39. httpget
  40.      
  41.  2.5:
  42. connect
  43.      
  44. resolve
  45.  "OS_ReadMonotonicTime" 
  46.  newtime%
  47.  newtime%-time% > update*6000 
  48. ticker_update
  49.  quit%
  50. close
  51. httpget
  52.  ptr%,flags%, request$
  53. .5   request$="GET /tickerdata/story2.dat HTTP/1.0"
  54. /X   
  55.  proxyonoff 
  56.  request$="GET http://www.bbc.co.uk/tickerdata/story2.dat HTTP/1.0"
  57.  "XSocket_Write",socket%!0,request$+
  58. (request$)+4 
  59. ptr%;flags%
  60.  (ptr%=0 
  61.  (flags% 
  62. 1)=1) 
  63.  !ptr% <> 36 
  64. 2U            connecterror=
  65. :error$="Failed to connect to server":connectstatus=4:
  66. connectstatus=3.5
  67.  at 0 in output file
  68. ("<ticker$dir>.story2")
  69. output=
  70. output_pos=0
  71. length=0
  72. ;"    a=
  73. ("<ticker$dir>.story2")
  74. resolve
  75.  status,ptr%,flags%
  76. host$="www.bbc.co.uk"
  77.  proxyonoff 
  78.  host$=$(proxyhost%)
  79.  mtresolv 
  80.  &66000,0,host$ 
  81. ,ptr%,flags%
  82.  ptr%=0 
  83.  (flags% 
  84.  1)=1 
  85.  connecterror=
  86. :error$="Resolving address failed":connectstatus=4:
  87. F& ip%=!!(ptr%!16):connectstatus=2.5
  88.  &46001,host$ 
  89.  status,ptr%;flags%
  90.  (flags% 
  91.  (status <> 36) 
  92.      
  93.  ptr%=0 
  94.  (flags% 
  95.  1)=1 
  96.  connecterror=
  97. :error$="Resolving address failed":connectstatus=4:b%!0=resolver%:
  98.  "Wimp_CloseWindow",,b%:
  99. K/   b%!0=resolver%:
  100.  "Wimp_CloseWindow",,b%
  101. L(   ip%=!!(ptr%!16):connectstatus=2.5
  102. connect
  103.  ptr%,flags%
  104. host$="www.bbc.co.uk"
  105. port=80 
  106.  &FFFF
  107.  proxyonoff 
  108.    host$=$(proxyhost%)
  109. W$   port=
  110. ($(proxyport%)) 
  111.  &FFFF
  112.  right lets try to connect
  113. ZJb%!0=2 
  114.  ((port 
  115. 256)<<16) 
  116.  ((port 
  117. 256)<<24):b%!4=ip%:b%!8=0:b%!12=0
  118.  "XSocket_Connect",socket%!0,b%,16 
  119.  ptr%;flags%
  120.  (flags% 
  121.  1)=1 
  122.  !ptr% 
  123. ^.     
  124.  36:connectstatus=2.5:connecterror=
  125. _.     
  126.  37:connectstatus=2.5:connecterror=
  127. `)     
  128.  56:connectstatus=3:
  129.  beep 
  130.      
  131. bB        connecterror=
  132. :error$=
  133. string0(ptr%+4):connectstatus=4
  134. addnewicon
  135. hE                   
  136.  (clickerror 
  137.  connecterror) 
  138. readfile
  139.                    
  140.  clickerror 
  141.  connecterror 
  142.  a$="  
  143.   "+error$+".  See help file for troubleshooting.":clickerror=
  144. :clickable(i+1)=
  145. j0                   
  146. updateicon((i+1)
  147. 7,a$,0)
  148. k,                   current=(current+1)
  149.  "OS_ReadMonotonicTime" 
  150.  sa-saold>3 
  151.       saold=sa
  152.       
  153.  i=0 
  154.          b%!0=main%:b%!4=i
  155. t'         
  156.  "Wimp_GetIconState",,b%
  157.          
  158.  b%!16>132 
  159. v+            x=b%!8-speed:xx=b%!16-speed
  160.             
  161.  x<132 
  162.  x=132
  163. x             
  164.  xx<132 
  165.  x=132
  166. y>             
  167.    SYS "Wimp_ResizeIcon",main%,i,x,-49,xx,-3
  168. z+               
  169.  "Wimp_DeleteIcon",,b%
  170. {.                b%!4=main%:b%!8=x:b%!16=xx
  171. |-               
  172.  "Wimp_CreateIcon",,b%+4
  173. }>                
  174.  i=current 
  175.  xx<windowwidth 
  176. addnewicon
  177.          
  178.       
  179.  "Wimp_BlockCopy",main%,132+speed,-49,windowwidth+speed,-3,132,-49
  180. threepointfive
  181. =    
  182.  "XSocket_Read",socket%!0,buffer%,2048 
  183.  len;flags%
  184. #    
  185.  len 
  186.  ((flags% 
  187. 1)=1) 
  188.  stuff in buffer
  189.      d=0
  190.        
  191.         a$=""
  192.          
  193.           a$+=
  194.  buffer%?d
  195.           d+=1
  196. >         
  197.  buffer%?(d-1) = 10 
  198.  buffer%?(d-1) = 13 
  199.  d=len
  200. +        
  201. a$,9)="BBCONLINE" 
  202.  output=
  203.          
  204. a$,7)="REFRESH" 
  205.                 b=
  206.                 a$=
  207. a$,b-1)
  208. 2                
  209.  $(headline%(8))<> 
  210. a$,b-9) 
  211. 7                
  212.  this is where we get headline.dat
  213.                 
  214.                 a$+=
  215.         
  216. )        
  217. a$,15)="Content-Length:" 
  218.                 b=
  219.                 a$=
  220. a$,b-1)
  221. '                length=
  222. a$,b-16))
  223.         
  224.             
  225.  output 
  226.                
  227. #a=output_pos
  228.               
  229. #a,a$;
  230.                output_pos=
  231. 4                  
  232.  length=output_pos 
  233.  length 
  234.                      
  235. )                      connectstatus=4
  236. :                      
  237.  "Socket_Shutdown",socket%!0,2
  238. 8                      
  239.  FIRSTGO 
  240.  connectstatus+=1
  241.                   
  242.             
  243.        
  244.  d=len
  245.         
  246. firstone
  247.  get first icon data
  248.  connecterror 
  249. readfile 
  250.  a$="  "
  251.  plot that first one
  252. getmodeinfo
  253. updateicon(0,a$,windowwidth-154)
  254.  connectstatus=5
  255.  FIRSTGO=
  256. readfile
  257.  x1$, x2$
  258. ("<ticker$dir>.story2")
  259. extent=
  260. #y1=position
  261.   x1$=
  262.   x1=
  263.  x1=extent 
  264.  position=0 
  265.  position=x1
  266. x1$,5)="STORY" 
  267.  channel(
  268. x1$,1)))
  269.  x1=extent 
  270. #y1=0
  271.   x1$=
  272.  x1>11
  273. x1$="  
  274. x1$,x1-9)
  275.   x1=
  276.  x1=extent 
  277.  position=0 
  278.  position=x1
  279.   x2$=
  280.  x2$ <10 
  281.  clickable((i+1)
  282.  clickable((i+1)
  283. updateicon(number,text$,add)
  284.  before,bwidth
  285.  ** calculate width of icon **
  286.  wimp 
  287.  "Wimp_TextOp",1,text$,0 
  288.  width 
  289.  width=
  290.  text$*16
  291.  ** where is the icon before?
  292. before=(number+6)
  293. b%!0=main%:b%!4=before
  294.  "Wimp_GetIconState",,b%
  295. bwidth=b%!16
  296. b%!0=main%:b%!4=number
  297.  "Wimp_GetIconState",,b%
  298.  "Wimp_DeleteIcon",,b%
  299. 7  b%!4=main%:b%!8=bwidth+add:b%!16=bwidth+width+add
  300.  "Wimp_CreateIcon",,b%+4
  301.   SYS "Wimp_ResizeIcon",main%,number,bwidth+add,-49,bwidth+width+add,-3
  302. $(message%(number))=a$
  303. close
  304.  "Wimp_CloseDown",task%,&4B534154
  305. "unset ticker$running"
  306.  "Wimp_Poll",,b% 
  307. windowopen
  308.  "Wimp_CloseWindow",,b%
  309.  b%!0=main% 
  310.  inwindow=
  311. makeblack(blue):blue=7
  312.  b%!0=main% 
  313.  inwindow=
  314. mouseclick
  315. processkey(b%!0,b%!4,b%!24)
  316. menuclick
  317.  17,18,19:
  318. receive(r%,b%)
  319. processkey(win,ico,key)
  320.  "Wimp_ProcessKey",key
  321. windowopen
  322.  !b%=main% 
  323.  modechanging 
  324. getmodeinfo 
  325.  "Wimp_OpenWindow",,b%
  326. receive(u,t%)
  327.  t%!16 
  328.  0:quit%=
  329.  &400C1
  330.      modechanging=
  331.  &4AF80
  332.      
  333.  u<>19 
  334. .     
  335.  now try and load prog to launch url
  336. >     
  337.  "XOS_ReadVarVal","Alias$URLOpen_HTTP",b%,256 
  338.       
  339.  u = 0 
  340.              clickerror=
  341. O             error$="No Application has been seen that can launch this URL"
  342.       
  343. .             $b%="URLOpen_HTTP "+launched$
  344. '             
  345.  "Wimp_StartTask",b%
  346.       
  347. colour=15
  348. toggle=
  349.  clickable(7)
  350. inwindow=
  351. blue=7
  352. modechanging=
  353. FIRSTGO=
  354. output=
  355.  socket% &10
  356.  headline%(8)
  357.  buffer% 2048
  358. connectstatus=0
  359. clickerror=
  360. connecterror=
  361. position=0
  362. current=0
  363.  b% 2048, menspc% 512, ws% 3072
  364.  message%(6)
  365.  channel(8)
  366. wsend%=ws%+3072
  367. quit%=
  368. connected=
  369. load_templates
  370. load_config
  371. ticker_menu
  372. attach(tickermenu%,0,infobox%)
  373. test_resolver
  374. init_sockets
  375. getmodeinfo
  376. test_resolver
  377.  ptr%,flags%
  378.  "XOS_Module",18,"Resolver" 
  379.  ,,,ptr%;flags%
  380.  (flags% 
  381.  mtresolv=
  382.  mtresolv=
  383. getmodeinfo
  384.  height%
  385. modechanging=
  386.  "OS_ReadModeVariable",-1,11 
  387.  ,,modewidth
  388.  "OS_ReadModeVariable",-1,12 
  389.  ,,modeheight
  390. modewidth+=1:modeheight+=1
  391.  connectstatus 
  392. !b%=main%
  393. @, b%!0=main%:
  394.  "Wimp_GetWindowState",,b%
  395. A2 b%!4=leftwindow:b%!16=topwindow:b%!8=b%!16-52
  396.  b%!12=b%!4+windowwidth
  397.  b%!12>modewidth*2 
  398.  b%!12=modewidth*2:windowwidth=b%!12-b%!4
  399.  toggle 
  400.  b%!12=b%!4+132
  401.  autoadjust 
  402.     windowwidth=modewidth*2
  403. G-    
  404.  windowwidth>3500 
  405.  windowwidth=3500
  406. H+    
  407.  windowwidth<500 
  408.  windowwidth=500
  409.     height=modeheight*2
  410.  iconbar 
  411.  height=188
  412. K<    b%!4=0:b%!8=height-52:b%!12=windowwidth:b%!16=height
  413.  toggle 
  414.  b%!12=132
  415.  "Wimp_OpenWindow",,b%
  416. toggle
  417.  toggle 
  418.  toggle=
  419.  toggle=
  420.    !b%=main%
  421. U#   
  422.  "Wimp_GetWindowState",,b%
  423.  toggle 
  424.    b%!12=b%!4+132
  425.    b%!12=b%!4+windowwidth
  426.  "Wimp_OpenWindow",,b%
  427. init_sockets
  428.  create a new socket for use, internet, stream
  429.  "Socket_Creat",2,1,0 
  430.  socket%!0
  431. !b%=-1
  432.  "Socket_Ioctl",socket%!0,&8004667E,b%
  433. load_config
  434.  a, b, r$
  435. ("<ticker$dir>.choices")
  436.    r$=
  437.    speed=
  438. (r$)*2
  439.    tempspeed=speed
  440.    $(speed%)=
  441. (speed*2)
  442.    updateonoff=
  443. o.   
  444.  updateonoff 
  445. iconstate(config%,7,1)
  446.    r$=
  447.    update=
  448.    tempupdate=update
  449. s-   $(update%)="Every "+
  450. (update)+" mins."
  451.  b=1 
  452.    r$=
  453.     channel(b)=
  454. w1    
  455.  channel(b) 
  456. iconstate(config%,b+11,1)
  457.    windowwidth=
  458. z*   
  459.  windowwidth<500 
  460.  windowwidth=500
  461. {,   
  462.  windowwidth>3500 
  463.  windowwidth=3500
  464.    $(proxyhost%)=
  465.    temphost$=$(proxyhost%)
  466.    $(proxyport%)=
  467.     tempport=
  468. ($(proxyport%))
  469.    r$=
  470.    proxyonoff=
  471.  proxyonoff 
  472. iconstate(config%,23,1)
  473.    $(headline%(8))=
  474.    autoadjust=
  475.  autoadjust 
  476. iconstate(config%,28,1)
  477.    iconbar=
  478.    leftwindow=
  479.    topwindow=
  480.    beep=
  481.  beep 
  482. iconstate(config%,30,1)
  483.    lowgraphics=
  484.  lowgraphics 
  485. iconstate(config%,29,1)
  486.    colour=
  487.  colour<0 
  488.  colour>15 
  489.  colour=15         
  490. ("<ticker$dir>.headline")
  491.       r$=
  492.  b=0 
  493.      $(headline%(b))=
  494. save_config
  495.  a, b, i
  496. ("<ticker$dir>.choices")
  497. (tempspeed/2)
  498. "    b=
  499. geticonstate(config%,7)
  500. (b)    
  501. (tempupdate)
  502.  i=1 
  503. &    b+=
  504. geticonstate(config%,11+i)
  505.  i=1 
  506. 4    
  507.  channel(i)=
  508. geticonstate(config%,11+i)
  509. (channel(i))
  510. (windowwidth)
  511. #a,$(proxyhost%)
  512. #a,$(proxyport%)
  513. #    b=
  514. geticonstate(config%,23)
  515. #a,$(headline%(8))
  516. #    b=
  517. geticonstate(config%,28)
  518. (iconbar)
  519.    !b%=main%
  520.  "Wimp_GetWindowState",,b%
  521. (b%!4)
  522. (b%!16)
  523. "   b=
  524. geticonstate(config%,30)
  525. "   b=
  526. geticonstate(config%,29)
  527.  colour  
  528. load_config
  529. load_templates
  530.  "Wimp_OpenTemplate",,"<ticker$Dir>.Templates"
  531.  "Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"main", 0 
  532.  ,,ws%
  533. message%(0)=b%!(108+(32*0))
  534. message%(1)=b%!(108+(32*1))
  535. message%(2)=b%!(108+(32*2))
  536. message%(3)=b%!(108+(32*3))
  537. message%(4)=b%!(108+(32*4))
  538. message%(5)=b%!(108+(32*5))
  539. message%(6)=b%!(108+(32*6))
  540.  "Wimp_CreateWindow",,b% 
  541.  main%
  542.  "Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"Info", 0 
  543.  ,,ws%
  544.  "Wimp_CreateWindow",,b% 
  545.  infobox%
  546.  "Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"config", 0 
  547.  ,,ws%
  548. speed%=b%!(108+(32*21))
  549. update%=b%!(108+(32*6))
  550.  i=0 
  551. #headline%(i)=b%!(108+32*(i+12))
  552. proxyhost%=b%!(108+(32*24))
  553. proxyport%=b%!(108+(32*25))
  554.  "Wimp_CreateWindow",,b% 
  555.  config%
  556.  "Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"message", 0 
  557.  ,,ws%
  558.  "Wimp_CreateWindow",,b% 
  559.  resolver%
  560.  "Wimp_CloseTemplate"
  561.  ** resize icons **
  562.  i=0 
  563.  SYS "Wimp_ResizeIcon",main%,i,132,-49,132,-3
  564. >             
  565.    SYS "Wimp_ResizeIcon",main%,i,x,-49,xx,-3
  566. +                      b%!0=main%:b%!4=i
  567. '         
  568.  "Wimp_GetIconState",,b%
  569. +               
  570.  "Wimp_DeleteIcon",,b%
  571. 1                b%!4=main%:b%!8=132:b%!16=132
  572. -               
  573.  "Wimp_CreateIcon",,b%+4
  574. colourchange
  575.  icon
  576.  "Wimp_GetPointerInfo",,b%
  577. icon=b%!16
  578.  icon>-1 
  579.  icon <8 
  580.  icon<>7 
  581.  icon<>blue 
  582.  clickable(icon) 
  583. makeblue(icon)
  584.  blue<>7 
  585.  clickable(blue) 
  586. makeblack(blue)
  587.    blue=icon
  588. makeblue(i)
  589.         b%!0=main%:b%!4=i
  590. )           
  591.  "Wimp_GetIconState",,b%
  592. #           b%!8=colour*&1000000
  593.            b%!12=&F000000
  594. )           
  595.  "Wimp_SetIconState",,b%
  596. makeblack(i)
  597.  i<0 
  598.  i>6 
  599.         b%!0=main%:b%!4=i
  600. )           
  601.  "Wimp_GetIconState",,b%
  602.            b%!8=&7000000
  603.            b%!12=&F000000
  604. )           
  605.  "Wimp_SetIconState",,b%
  606. mouseclick
  607.  b%!12 
  608.  main%:
  609.  b%!8 
  610. .    
  611. showmenu(tickermenu%,!b%-64,b%!4)
  612.  4:i=b%!16:
  613. Z        
  614.  7:b%!0=main%:b%!4=1:b%!8=10:b%!12=10:b%!16=50:b%!20=50:
  615.  "Wimp_DragBox",,b%
  616.         
  617.         
  618.  i<>7 
  619. +           a$=
  620. geticontext(main%,b%!16)
  621.            
  622. load_url(a$)
  623.         
  624.  1:i=b%!16:
  625.          
  626. toggle
  627.         
  628.  config%:
  629.  b%!16 
  630. 5       
  631.  3:b%!0=config%:
  632.  "Wimp_CloseWindow",,b%
  633. B       
  634. save_config:b%!0=config%:
  635.  "Wimp_CloseWindow",,b%
  636.        
  637.  tempspeed>2 
  638.  tempspeed-=2:$(speed%)=
  639. (tempspeed/2):b%!0=config%:b%!4=21:b%!8=0:b%!12=0:
  640.  "Wimp_SetIconState",,b%
  641.        
  642.  tempspeed<20 
  643.  tempspeed+=2:$(speed%)=
  644. (tempspeed/2):b%!0=config%:b%!4=21:b%!8=0:b%!12=0:
  645.  "Wimp_SetIconState",,b%
  646.        
  647.  tempupdate >1 
  648.  tempupdate-=1:$(update%)="Every "+
  649. (tempupdate)+" mins.":b%!0=config%:b%!4=6:b%!8=0:b%!12=0:
  650.  "Wimp_SetIconState",,b%
  651.        
  652.  tempupdate <60 
  653.  tempupdate+=1:$(update%)="Every "+
  654. (tempupdate)+" mins.":b%!0=config%:b%!4=6:b%!8=0:b%!12=0:
  655.  "Wimp_SetIconState",,b%
  656.        
  657. proxy_shade
  658.        
  659. update_shade
  660. 3       
  661.  27: 
  662. "Filer_OpenDir <ticker$dir>.help"
  663. proxy_shade
  664. geticonstate(config%,23)
  665.  i=24 
  666. iconshade(config%,i,
  667. update_shade
  668. geticonstate(config%,7)
  669. iconshade(config%,6,
  670. iconshade(config%,10,
  671. iconshade(config%,11,
  672. load_url(a$)
  673. a$,x2-5)
  674. ("<ticker$dir>.story2")
  675. #y2=0
  676.   x2$=
  677. x2$,8)="HEADLINE" 
  678.      x2=
  679.      x2$=
  680. x2$,x2-9)
  681.  x2=t2 
  682.  x2$=a$
  683.  x2$=a$ 
  684.   x2$=
  685.   t2=
  686.   x2$=
  687. x2$,t2-4)
  688.  x2$<>"" 
  689. launch_url(x2$)
  690. ticker_update
  691.  Shit! Time to update the ticker
  692.  we ARE NOT connected, honest
  693.  "OS_ReadMonotonicTime" 
  694.  time%
  695.  toggle 
  696. connectstatus=0
  697. position=0
  698. init_sockets
  699. connectstatus=1
  700.  mtresolv 
  701. open_resolver_window
  702. open_resolver_window
  703. b%!0=resolver%
  704.  "Wimp_GetWindowState",,b%
  705. U%b%!4=modewidth-196:b%!12=b%!4+392
  706. V%b%!8=modeheight-96:b%!16=b%!8+192
  707.  "Wimp_OpenWindow",,b%
  708. launch_url(a$)
  709.  hi%, len%, temp$
  710. \!b%!0=256:b%!12=0:b%!16=&4AF80
  711.  lowgraphics 
  712.  hi%=
  713. a$,"/hi/"):len%=
  714. _ temp$=
  715. a$,len%-(len%-hi%)-1)
  716. temp$+="/low/"
  717. temp$+=
  718. a$,len%-hi%-3)
  719. a$=temp$
  720. $(b%+20)=a$+
  721.  "Wimp_SendMessage",18,b%,0,0
  722. launched$=a$
  723. menuclick
  724. c%=b%+900
  725.  "Wimp_GetPointerInfo",,c%
  726. adj%=(c%!8 
  727.  "Wimp_DecodeMenu",,topmenu%,b%,c%
  728.  $c% 
  729.  "Quit":quit%=
  730.  "Update Now":
  731. ticker_update
  732.  "The BBC":
  733. launch_url("http://www.bbc.co.uk/")
  734.  "News Online":
  735. launch_url("http://news.bbc.co.uk")
  736.  "Updates...":
  737. launch_url("http://www.geocities.com/Paris/Lights/7724")
  738.  "Choices":
  739. update_choices
  740.  adj% 
  741. showmenu(topmenu%,topx%,topy%)
  742. update_choices
  743.  c%=1 
  744. iconstate(config%,c%+11,-channel(c%))
  745. $(speed%)=
  746. (speed/2)
  747. *$(update%)="Every "+
  748. (update)+" mins."
  749. $(proxyport%)=
  750. (tempport)
  751. $(proxyhost%)=temphost$
  752. iconstate(config%,23,proxyonoff)
  753. iconstate(config%,28,autoadjust)
  754. iconstate(config%,30,beep)
  755. iconstate(config%,29,lowgraphics)
  756. proxy_shade
  757. update_shade
  758. E!b%=config%:
  759.  "Wimp_GetWindowState",,b%:
  760.  "Wimp_OpenWindow",,b%
  761.  ---- menu stuff ----
  762. make_menu
  763. start%=menspc%
  764.  title$
  765. $(start%)=title$
  766. start%?12=7
  767. start%?13=2
  768. start%?14=7
  769. start%?15=0
  770. start%!20=44
  771. start%!24=0
  772. width%=
  773. (title$)-3
  774. menspc%+=28
  775.  item$
  776.  item$<>"*" 
  777. !menspc%=0
  778. writeable%=
  779. item$,"_")
  780.  ul% 
  781. tail$=
  782. item$,
  783. (item$)-ul%)
  784. tail$,"T") !menspc%=!menspc% 
  785. tail$,"D") !menspc%=!menspc% 
  786. tail$,"W") !menspc%=!menspc% 
  787.  4:writeable%=
  788.  buffer%:
  789.  buflen%
  790. tail$,"M") !menspc%=!menspc% 
  791. item$=
  792. item$,ul%-1)
  793.  item$>width% width%=
  794.  item$
  795. menspc%!4=-1
  796.  writeable% 
  797. Zmenspc%!8=&0700F121:menspc%!12=buffer%:menspc%!16=-1:menspc%!20=buflen%:$buffer%=item$
  798.  item$<12 
  799. +menspc%!8=&07000021:$(menspc%+12)=item$
  800. Imenspc%!8=&0700F121:menspc%!12=ws%:mwnspc%!16=-1:menspc%!20=
  801.  item$+1
  802. $ws%=item$:ws%+=
  803.  item$+1
  804. menspc%+=24
  805.  item$="*"
  806. start%!16=width%*16+32
  807. %!(menspc%-24)=!(menspc%-24) 
  808. mptr%=menspc%
  809. =start%
  810. attach(menu%,item%,sub%)
  811. !(menu%+28+item%*24+4)=sub%
  812. showmenu(menu%,x%,y%)
  813. $topmenu%=menu%:topx%=x%:topy%=y%
  814.  "Wimp_CreateMenu",,menu%,x%,y%
  815. ticker_menu
  816.  Ticker,Info,Choices,Update Now,Quit_D,The BBC,News Online,Updates...,*
  817. tickermenu%=
  818. make_menu
  819. geticonstate(win%,icon%)
  820. 2!b%=win%:b%!4=icon%:
  821.  "Wimp_GetIconState",,b%
  822. =(b%!24>>21 
  823.  1)>0
  824. iconstate(win%,icon%,type%)
  825.  s%,t%
  826.  type% 
  827.  0:s%=0<<21:t%=1<<21
  828.  -1,1:s%=1<<21:t%=1<<21
  829.  2:s%=1<<21:t%=0<<21
  830. )b%!0=win%:b%!4=icon%:b%!8=s%:b%!12=t%
  831.  "Wimp_SetIconState",,b%
  832. iconshade(win%,icon%,type%)
  833.  s%,t%
  834.  type% 
  835.  0:s%=0<<22:t%=1<<22
  836.  -1,1:s%=1<<22:t%=1<<22
  837.  2:s%=1<<22:t%=0<<22
  838. )b%!0=win%:b%!4=icon%:b%!8=s%:b%!12=t%
  839.  "Wimp_SetIconState",,b%
  840. geticontext(win%,icon%)
  841. 3b%!0=win%:b%!4=icon%:
  842.  "Wimp_GetIconState",,b%
  843.  ((b%!24) 
  844.  &100)=0 
  845. string0(b%+28)
  846. string0(b%!28)
  847. string0(a%):
  848.  a%=0 
  849. ?a%>31 
  850. (a$)<255:a$=a$+
  851. ?a%:a%=a%+1:
  852.